
JavaScript have many number methods for number modification or conversion. We can get many types of number or data type using this number method. JavaScript number methods are very useful for programmer to convert data type or get the many important property from the any number variables like “NaN” is also a type of number type. Now given bellow some number function and property name:
JavaScript number methods
• parseInt
• parseInt
• Number
JavaScript number properties:
• MAX_VALUE
• MIN_VALUE
• POSITIVE_INFINITY
• NEGATIVE_INFINITY
• NaN
Now given bellow the number method code and explain the code:
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<script type="text/javascript">
// Use Number method and proparty
//this value is Float
var myFloat=102.50;
console.log("Float value :"+myFloat);
//int to covert int
var myInt=parseInt(myFloat);
console.log("Int value :"+myInt);
//NaN value assign
var myNan=Number.NaN;
console.log("Show the NaN value :"+myNan);
//create string type
var name="jesy";
var myDev=15/name;
console.log("Show the value of myDev :"+myDev);
//INFINITY value print
var myInf=1/0;
console.log("Show the infinity :"+myInf);
</script>
</body>
</html>
In this code we will show some JavaScript number function which is responsible to convert the data type very easily. We also see the JavaScript number property for which value are get back in number data type.